package edu.sctu.practice.class02.yangshengyu.one10;

import java.util.Scanner;

/**
 * Created by Cullen on 2015/8/3.
 */
public class N7 {
    public static void main(String[] args) {
        System.out.println("请输入前N项和的N的值：");
        Scanner a=new Scanner(System.in);
        int sc;
        sc=a.nextInt();
        int b=8;
        int sum=8;
        int i;
        for(i = 1; i<=(sc-1);i++) {
            b = b + (8 * ((10) ^ i));
            sum = sum + b;
        }
        sum=sum-8;
        System.out.println("前"+sc+"项和为："+sum);
    }
}
